export const nowDateTime = () => {
  let date = new Date()

  let year = date.getFullYear()
  let month = date.getMonth() + 1 // getMonth()返回的是0-11的值
  let day = date.getDate()
  let hours = date.getHours()
  let minutes = date.getMinutes()
  let seconds = date.getSeconds()

  // 为了保持格式为两位数，如果小于10，前面补0
  month = (month < 10 ? '0' : '') + month
  day = (day < 10 ? '0' : '') + day
  hours = (hours < 10 ? '0' : '') + hours
  minutes = (minutes < 10 ? '0' : '') + minutes
  seconds = (seconds < 10 ? '0' : '') + seconds

  return (
    year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
  )
}
